import request from '@/utils/request.ts'
import { Menu, MenuTreeListParam, MenuSaveOrUpdateParam, MenuRemoveParam } from '@/types'

export const menuTreeList = (param: MenuTreeListParam): Promise<Menu[]> => {
  return request({
    url: '/menu/tree/list',
    method: 'post',
    data: param,
  })
}

export const saveOrUpdate = (param: MenuSaveOrUpdateParam): Promise<Menu> => {
  return request({
    url: '/menu/saveOrUpdate',
    method: 'post',
    data: param,
  })
}

export const remove = (param: MenuRemoveParam): Promise<unknown> => {
  return request({
    url: '/menu/remove',
    method: 'post',
    data: param,
  })
}
